/*
 * EdgeNode.cpp
 *
 *  Created on: 19/09/2009
 *      Author: Santi
 */

#include "EdgeNode.h"
#include <typeinfo>

EdgeNode::EdgeNode() {}

EdgeNode::~EdgeNode() {
	delete data;
	//std::cout << "Kill edge node\n";
}

Edge* EdgeNode::getNodeValue() const{
	return this->data;
}

void EdgeNode::setNodeValue(Edge* value) {
	this->data = value;
}

EdgeNode::EdgeNode(const EdgeNode &edgeNode) {
	this->setNext(edgeNode.getNext());
	data = edgeNode.data;
}

EdgeNode& EdgeNode::operator=(const EdgeNode &edgeNode) {
	this->setNext(edgeNode.getNext());
	this->data = edgeNode.data;
	return *this;
}

EdgeNode* EdgeNode::clone() const {
	return new EdgeNode(*this);
}

bool EdgeNode::equals(const Node& node) const {
	if (typeid(&node) == typeid(this)) {
		EdgeNode& edgeNode = (EdgeNode&)node;
		if (this->getNodeValue()->getId().compare(edgeNode.getNodeValue()->getId()) == 0) {
			return true;
		}
	}
	return false;
}
